home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-09-28 | 3.3 KB | 102 lines |
- /*
- * QuickTime for Java SDK Sample Code
-
- Usage subject to restrictions in SDK License Agreement
- * Copyright: © 1996-1999 Apple Computer, Inc.
-
- */
- import java.awt.event.*;
- import java.awt.*;
- import java.io.*;
-
- import quicktime.std.movies.*;
- import quicktime.std.*;
- import quicktime.*;
- import quicktime.qd.*;
-
- import quicktime.io.QTFile;
- import quicktime.app.image.GraphicsImporterDrawer;
- import quicktime.app.display.*;
- import quicktime.app.QTFactory;
-
- import quicktime.app.image.*;
- import quicktime.util.*;
-
- import qteffect.ControlPanel;
-
- public class PlayQTEffectApp extends Frame implements QDConstants, StdQTConstants, Errors {
- public static void main (String args[]) {
- PlayQTEffectApp pe = new PlayQTEffectApp("QT Effects");
- pe.show();
- pe.toFront();
- }
-
- PlayQTEffectApp (String name) {
- super (name);
- try {
- addNotify();
- Insets ins = getInsets();
- setBounds (0, 0, (400 + ins.left + ins.right), (400 + ins.top + ins.bottom));
- QTSession.open();
-
- File file1 = QTFactory.findAbsolutePath ("pics/house.jpg");
- File file2 = QTFactory.findAbsolutePath ("pics/icons.jpg");
- QTFile f1 = new QTFile (file1.getAbsolutePath());
- QTFile f2 = new QTFile (file2.getAbsolutePath());
-
- Compositable sourceImage = new GraphicsImporterDrawer (f1);
- Compositable destImage = new GraphicsImporterDrawer (f2);
- /*
- // Example Code for creating a filter
- QTFilter ef = new QTFilter ();
- AtomContainer effectSample = new AtomContainer();
- effectSample.insertChild (new Atom(kParentAtomIsContainer), kEffectWhatAtom, 1, 0, kEmbossImageFilterType);
- ef.setSourceImage (sourceImage);
- ef.setEffect (effectSample);
- */
-
- // Example Code for creating a transition
- QTTransition ef = new QTTransition ();
- ef.setTime (800);
- ef.setSourceImage (sourceImage);
- ef.setDestinationImage (destImage);
- ef.setProfiled(true);
- ef.setEffect (createSMPTEEffect (kEffectWipe, kRandomWipeTransitionType));
-
- QTCanvas qtCanvas = new QTCanvas(QTCanvas.kAspectResize, 0.5f, 0.5f);
- add("Center", qtCanvas);
- ControlPanel cp = new ControlPanel (ef, qtCanvas);
- add ("North", cp);
-
- qtCanvas.setClient (ef, true);
- addWindowListener(new WindowAdapter () {
- public void windowClosing (WindowEvent e) {
- QTSession.close();
- dispose();
- }
- public void windowClosed (WindowEvent e) {
- System.exit(0);
- }
- });
- } catch (Exception e) {
- throw new QTRuntimeException (e.getMessage());
- }
- }
-
- public static void showDialog (QTEffect ef) throws QTException {
- AtomContainer effectSample = ParameterDialog.showParameterDialog (new EffectsList (2, 2, 0), 0);
- ef.setEffect (effectSample);
- }
-
- public AtomContainer createSMPTEEffect (int effectType, int effectNumber) throws QTException {
- AtomContainer effectSample = new AtomContainer();
-
- // We are using SMPTE Effects so set the what atom to smpt
- effectSample.insertChild (new Atom(kParentAtomIsContainer), kEffectWhatAtom, 1, 0, EndianOrder.flipNativeToBigEndian32(kWipeTransitionType));
-
- // We are using SMPTE effect number 74 - start at 0%, stop at 100%
- effectSample.insertChild (new Atom(kParentAtomIsContainer), effectType, 1, 0, EndianOrder.flipNativeToBigEndian32(effectNumber));
- return effectSample;
- }
- }
-